From 531074df1d1670b1a75b1f8b22c9e916641b18d1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 12 Dec 2008 04:55:11 +0000 Subject: [PATCH] (bug 12716) Unprotecting a non-protected page leaves a log entry --- includes/Article.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 523f9eb90a..eb8f329aa3 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1857,14 +1857,23 @@ class Article { $changed = false; foreach( $wgRestrictionTypes as $action ) { if( isset( $expiry[$action] ) ) { - $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); - $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) ); + # Get current restrictions on $action + $aLimits = $this->mTitle->getRestrictions( $action ); + $current[$action] = implode( '', $aLimits ); + # Are any actual restrictions being dealt with here? + $aRChanged = count($aLimits) || !empty($limit[$action]); + # If something changed, we need to log it. Checking $aRChanged + # assures that "unprotecting" a page that is not protected does + # not log just because the expiry was "changed". + if( $aRChanged && $this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action] ) { + $changed = true; + } } } $current = Article::flattenRestrictions( $current ); - $changed = ($changed || ( $current != $updated ) ); + $changed = ($changed || $current != $updated ); $changed = $changed || ($updated && $this->mTitle->areRestrictionsCascading() != $cascade); $protect = ( $updated != '' ); -- 2.20.1